Advertisement
MeehoweCK

Untitled

May 18th, 2024
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. int modulo_large_number(const std::string& number, int divisor) {
  2.     int result = 0;
  3.  
  4.     // Iterujemy przez każdą cyfrę liczby
  5.     for (char digit : number) {
  6.         // Aktualizujemy wynik o kolejną cyfrę
  7.         result = (result * 10 + (digit - '0')) % divisor;
  8.     }
  9.  
  10.     return result;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement